﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR44Response", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR44Response))]
    public class RR44ResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR44Response clazz;
        
        public RR44ResponseSerializer(IRR44Response clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("isikuandmed");
            if (clazz.Isikuandmed!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR44Response>isikuandmed>isikuandmed", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Isikuandmed.Count);
                for (int x = 0; ((clazz.Isikuandmed != null) 
                            && (x < clazz.Isikuandmed.Count)); x = (x + 1)) {
                    if (clazz.Isikuandmed[x]!=null) {
                        Writer.WriteStartElement("isikuandmed");
                        global::Xtee.Core.SerializationMetadata metaIsikuandmed = this.GetMetaData(clazz.Isikuandmed[x]);
                        Writer.WriteTypeAttribute(metaIsikuandmed.TypeQualifiedName.Namespace, metaIsikuandmed.TypeQualifiedName.Name);
                        metaIsikuandmed.NewSerializer(clazz.Isikuandmed[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Suhteandmed");
            if (clazz.Suhteandmed!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR44Response>Suhteandmed>Suhteandmed", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Suhteandmed.Count);
                for (int x = 0; ((clazz.Suhteandmed != null) 
                            && (x < clazz.Suhteandmed.Count)); x = (x + 1)) {
                    if (clazz.Suhteandmed[x]!=null) {
                        Writer.WriteStartElement("Suhteandmed");
                        global::Xtee.Core.SerializationMetadata metaSuhteandmed = this.GetMetaData(clazz.Suhteandmed[x]);
                        Writer.WriteTypeAttribute(metaSuhteandmed.TypeQualifiedName.Namespace, metaSuhteandmed.TypeQualifiedName.Name);
                        metaSuhteandmed.NewSerializer(clazz.Suhteandmed[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Suhteandmed");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="isikuandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR44Response>isikuandmed");
                }
                clazz.Isikuandmed = new System.Collections.Generic.List<RR44Response.IIsikuandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("isikuandmed");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "isikuandmed")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR44Response>isikuandmed>isikuandmed");
                        }
                        global::Xtee.Core.SerializationMetadata metaIsikuandmed = this.GetMetaData<RR44Response.IIsikuandmedType>(Reader, ">>>RR44Response>isikuandmed>isikuandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR44Response.IIsikuandmedType item = metaIsikuandmed.NewEntity<RR44Response.IIsikuandmedType>();
                        clazz.Isikuandmed.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("isikuandmed");
                            metaIsikuandmed.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR44Response>isikuandmed", Reader.LocalName);
            }
            if (Reader.LocalName=="Suhteandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR44Response>Suhteandmed");
                }
                clazz.Suhteandmed = new System.Collections.Generic.List<RR44Response.ISuhteandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Suhteandmed");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Suhteandmed")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR44Response>Suhteandmed>Suhteandmed");
                        }
                        global::Xtee.Core.SerializationMetadata metaSuhteandmed = this.GetMetaData<RR44Response.ISuhteandmedType>(Reader, ">>>RR44Response>Suhteandmed>Suhteandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR44Response.ISuhteandmedType item = metaSuhteandmed.NewEntity<RR44Response.ISuhteandmedType>();
                        clazz.Suhteandmed.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Suhteandmed");
                            metaSuhteandmed.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR44Response>Suhteandmed", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR44Response>isikuandmed>isikuandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR44Response.IsikuandmedType))]
        public class IsikuandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR44Response.IIsikuandmedType clazz;
            
            public IsikuandmedTypeSerializer(RR44Response.IIsikuandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("isikuandmed.Perenimi");
                if (clazz.IsikuandmedPerenimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedPerenimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedPerenimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Eesnimi");
                if (clazz.IsikuandmedEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedEesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedEesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Sugu");
                if (clazz.IsikuandmedSugu!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedSugu))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedSugu");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Synniaeg");
                if (clazz.IsikuandmedSynniaeg!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedSynniaeg))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedSynniaeg");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Staatus");
                if (clazz.IsikuandmedStaatus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedStaatus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedStaatus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Eesti_aadress");
                if (clazz.IsikuandmedEestiAadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedEestiAadress))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedEestiAadress");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdoktyyp");
                if (clazz.Isikuandmedtdoktyyp!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdoktyyp))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdoktyyp");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdokseeria");
                if (clazz.Isikuandmedtdokseeria!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdokseeria))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdokseeria");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdoknr");
                if (clazz.Isikuandmedtdoknr!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdoknr))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdoknr");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdokvaljakp");
                if (clazz.Isikuandmedtdokvaljakp!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdokvaljakp))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdokvaljakp");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdokkehta");
                if (clazz.Isikuandmedtdokkehta!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdokkehta))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdokkehta");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdokkehtl");
                if (clazz.Isikuandmedtdokkehtl!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdokkehtl))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdokkehtl");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.tdokstaatus");
                if (clazz.Isikuandmedtdokstaatus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Isikuandmedtdokstaatus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Isikuandmedtdokstaatus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Rahvus");
                if (clazz.IsikuandmedRahvus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedRahvus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedRahvus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Emakeel");
                if (clazz.IsikuandmedEmakeel!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedEmakeel))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedEmakeel");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Haridus");
                if (clazz.IsikuandmedHaridus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedHaridus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedHaridus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("isikuandmed.Tegevusala");
                if (clazz.IsikuandmedTegevusala!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuandmedTegevusala))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuandmedTegevusala");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="isikuandmed.Perenimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Perenimi");
                    }
                    clazz.IsikuandmedPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Perenimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Perenimi", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Eesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Eesnimi");
                    }
                    clazz.IsikuandmedEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Eesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Eesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Sugu") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Sugu");
                    }
                    clazz.IsikuandmedSugu = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Sugu")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Sugu", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Synniaeg") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Synniaeg");
                    }
                    clazz.IsikuandmedSynniaeg = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Synniaeg")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Synniaeg", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Staatus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Staatus");
                    }
                    clazz.IsikuandmedStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Staatus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Staatus", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Eesti_aadress") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Eesti_aadress");
                    }
                    clazz.IsikuandmedEestiAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Eesti_aadress")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Eesti_aadress", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdoktyyp") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdoktyyp");
                    }
                    clazz.Isikuandmedtdoktyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdoktyyp")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdoktyyp", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdokseeria") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokseeria");
                    }
                    clazz.Isikuandmedtdokseeria = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdokseeria")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokseeria", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdoknr") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdoknr");
                    }
                    clazz.Isikuandmedtdoknr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdoknr")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdoknr", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdokvaljakp") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokvaljakp");
                    }
                    clazz.Isikuandmedtdokvaljakp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdokvaljakp")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokvaljakp", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdokkehta") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokkehta");
                    }
                    clazz.Isikuandmedtdokkehta = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdokkehta")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokkehta", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdokkehtl") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokkehtl");
                    }
                    clazz.Isikuandmedtdokkehtl = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdokkehtl")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokkehtl", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.tdokstaatus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokstaatus");
                    }
                    clazz.Isikuandmedtdokstaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.tdokstaatus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.tdokstaatus", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Rahvus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Rahvus");
                    }
                    clazz.IsikuandmedRahvus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Rahvus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Rahvus", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Emakeel") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Emakeel");
                    }
                    clazz.IsikuandmedEmakeel = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Emakeel")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Emakeel", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Haridus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Haridus");
                    }
                    clazz.IsikuandmedHaridus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Haridus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Haridus", Reader.LocalName);
                }
                if (Reader.LocalName=="isikuandmed.Tegevusala") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Tegevusala");
                    }
                    clazz.IsikuandmedTegevusala = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("isikuandmed.Tegevusala")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>isikuandmed>isikuandmed>isikuandmed.Tegevusala", Reader.LocalName);
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR44Response>Suhteandmed>Suhteandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR44Response.SuhteandmedType))]
        public class SuhteandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR44Response.ISuhteandmedType clazz;
            
            public SuhteandmedTypeSerializer(RR44Response.ISuhteandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Suhteandmed.ssuhtetyyp");
                if (clazz.Suhteandmedssuhtetyyp!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Suhteandmedssuhtetyyp))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Suhteandmedssuhtetyyp");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sIsikukood");
                if (clazz.SuhteandmedsIsikukood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsIsikukood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsIsikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sPerenimi");
                if (clazz.SuhteandmedsPerenimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsPerenimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsPerenimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sEesnimi");
                if (clazz.SuhteandmedsEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsEesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsEesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sIsanimi");
                if (clazz.SuhteandmedsIsanimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsIsanimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsIsanimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sEesti_aadress");
                if (clazz.SuhteandmedsEestiAadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsEestiAadress))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsEestiAadress");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhteandmed.sStaatus");
                if (clazz.SuhteandmedsStaatus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhteandmedsStaatus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhteandmedsStaatus");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Suhteandmed.ssuhtetyyp") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.ssuhtetyyp");
                    }
                    clazz.Suhteandmedssuhtetyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.ssuhtetyyp")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.ssuhtetyyp", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sIsikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sIsikukood");
                    }
                    clazz.SuhteandmedsIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sIsikukood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sIsikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sPerenimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sPerenimi");
                    }
                    clazz.SuhteandmedsPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sPerenimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sPerenimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sEesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sEesnimi");
                    }
                    clazz.SuhteandmedsEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sEesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sEesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sIsanimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sIsanimi");
                    }
                    clazz.SuhteandmedsIsanimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sIsanimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sIsanimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sEesti_aadress") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sEesti_aadress");
                    }
                    clazz.SuhteandmedsEestiAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sEesti_aadress")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sEesti_aadress", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhteandmed.sStaatus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sStaatus");
                    }
                    clazz.SuhteandmedsStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhteandmed.sStaatus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR44Response>Suhteandmed>Suhteandmed>Suhteandmed.sStaatus", Reader.LocalName);
                }
            }
        }
    }
}
